<template>
	<view class="record_container">
		<view class="record_live_box">
			<view class="record_live_title" @click="handleCheckLive('直播话术')">
				《直播话术》
			</view>
			<view class="record_live_line">

			</view>
			<view class="record_live_title" @click="handleCheckLive('直播违禁词')">
				《直播违禁词》
			</view>
		</view>
		<view class="record_box">
			<view class="record_all" v-for="(item, index) in dyApplyList" :key="index">
				<view class="record_top_box">
					<view class="">
						<view class="record_uid">
							抖音UID：<span style="font-family: my-font;">{{item.dy_uid}}</span>
						</view>
						<view class="record_code">
							抖音号：<span style="font-family: my-font;">{{item.dy_code}}</span>
						</view>
					</view>
					<view class="record_status">
						<span v-if="item.status == 0"
							style="color: font-family: Source Han Sans CN;font-weight: 400;font-size: 26rpx;color: #888;">待审核</span>
						<span v-else-if="item.status == 1"
							style="color: font-family: Source Han Sans CN;font-weight: 400;font-size: 26rpx;color: green;">审核成功</span>
						<span v-else-if="item.status == 2"
							style="color: font-family: Source Han Sans CN;font-weight: 400;font-size: 26rpx;color: #FF2E2E;">审核失败</span>
					</view>
				</view>
				<view class="record_top_date">
					申请时间：<span style="font-family: my-font;">{{item.created_at}}</span>
				</view>
			</view>
		</view>

		<!-- 弹窗提示 -->
		<u-popup v-model="showLiveTip" mode="center" width="680" border-radius="12" :closeable="true"
			close-icon-color="#000">
			<view class="popup_tip_box">
				<view class="popup_tip_con">
					请仔细阅读并熟知<span style="color: #2089f7;" @click="handleCheckLive('直播话术')">《直播话术》</span>和<span
						style="color: #2089f7;"
						@click="handleCheckLive('直播违禁词')">《直播违禁词》</span>，如在直播中出现违规情况，将关停带货链接并上报抖音官方
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageObj: {
					pageNow: 1,
					pageSize: 100
				},
				dyApplyList: [],
				liveStreamingObj: {},
				showLiveTip: true
			}
		},
		onShow() {
			this.getSystemSettingInfo()
			this.getDyLiveApplyList()
		},
		methods: {
			// 查看直播文字
			handleCheckLive(val) {
				if (val == '直播话术') {
					let url = this.liveStreamingObj.live_speech
					uni.navigateTo({
						url: '/pages/my/douyinWebview/douyinWebview?url=' + url
					})
				} else if (val == '直播违禁词') {
					let url = this.liveStreamingObj.forbidden_word
					uni.navigateTo({
						url: '/pages/my/douyinWebview/douyinWebview?url=' + url
					})
				}
			},

			// 获取直播话术和违禁词接口
			getSystemSettingInfo() {
				this.$request('/api/getSystemSettingInfo', {}, 'GET').then(res => {
					if (res.code == 1) {
						this.liveStreamingObj = res.data
					} else {
						uni.showToast({
							title: '数据获取失败',
							icon: 'none'
						})
						return
					}
				})
			},

			// 抖音列表接口
			getDyLiveApplyList() {
				this.$request('/api/getDyLiveApplyList', {
					page_now: this.pageObj.pageNow,
					page_size: this.pageObj.pageSize
				}, 'GET').then(res => {
					if (res.code == 1) {
						this.dyApplyList = res.data
					} else {
						uni.showToast({
							title: '记录查询失败',
							icon: 'none'
						})
						return
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.record_container {
		padding: 30rpx 20rpx;

		.record_live_box {
			display: flex;
			justify-content: center;
			align-items: center;
			background: #fff;
			color: #2089f7;
			font-family: all-font;
			font-size: 28rpx;
			padding: 20rpx 0;

			.record_live_line {
				width: 4rpx;
				height: 30rpx;
				background: #888;
				margin: 0 10rpx;
			}
		}

		.record_all {
			background: #fff;
			padding: 20rpx 30rpx;

			.record_top_box {
				display: flex;
				justify-content: space-between;
				font-family: all-font;
				font-weight: 500;
				font-size: 30rpx;
				color: #333333;

				.record_uid {}

				.record_code {
					padding: 6rpx 0 20rpx;
				}
				
				.record_status {
					font-family: all-font;
				}
			}

			.record_top_date {
				font-weight: normal;
				font-size: 26rpx;
				font-family: all-font;
				color: #808080;
			}
		}

		.popup_tip_box {
			font-family: all-font;
			padding: 70rpx 20rpx 30rpx;

			.popup_tip_con {
				line-height: 45rpx;
				text-indent: 2em;
				font-size: 30rpx;
			}
		}
	}
</style>